package command.gew;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import command.ICommand;

public class ConfigurarGewCommand implements ICommand{

	@Override
	public String execute(HttpServletRequest request) throws ServletException,IOException {
		
		HttpSession session = request.getSession();
		String[] boxEmocoes = request.getParameterValues("emocao");
		
		ArrayList<Integer> emocoes = new ArrayList<Integer>();
		
		for(int i=0; i < boxEmocoes.length; i++){
			emocoes.add(Integer.parseInt(boxEmocoes[i]));
		}
		
		if(emocoes.size() < 10 ){
			session.setAttribute("emocoes", emocoes);
			return "controller.do?acao=listarQuestionario&erro=mnqd";
		}
		else{
			session.setAttribute("emocoes", emocoes);
			return "controller.do?acao=listarRespondenteParaGew";
		}
	}

}
